from django.shortcuts import render, render_to_response
from django.http import HttpResponse, FileResponse
import os
from config import Config


def index(request):
    return render_to_response('csmonitor/index.html')


def csmonitor(request):
    template_path = request.path.strip('/')
    if not template_path.endswith('.html'):
        sending = open(os.path.join(Config.TEMPLATE, template_path), 'rb')
        return FileResponse(sending)
    return render_to_response(template_path)
